@extends('backend::common.common_right')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <a class="btn btn-primary" href="{{url('backend/admincreate/0')}}" >
                            添加
                        </a>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover " id="editable">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>用户名</th>
                                <th>用户角色</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($admins as $admin)
                                <tr class="gradeX">
                                    <td>{{$admin->id}}</td>
                                    <td>{{$admin->name}}</td>
                                    <td class="center">
                                        @if($admin->level == 1)
                                            运营
                                        @elseif($admin->level == 2)
                                            客服
                                        @else
                                            超级管理员
                                        @endif
                                    </td>
                                    <td class="center">
                                        <a href="{{url('backend/admincreate',['id'=>$admin->id])}}" ><i class="fa fa-pencil"></i>编辑</a>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                        {{$admins->links()}}
                    </div>
                </div>
            </div>
        </div>
        <script>
            $('#seach').change(function () {
                var seachname = $(this).children('option:selected').val()
                $("#seachname").attr('name', seachname);
            })
            var del = function (id) {
                layer.confirm('禁用此用户？', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    window.location.href = "{{url('backend/usersdel')}}/" + id;
                }, function () {
                });
            }

            var use = function (id) {
                layer.confirm('启用此用户？', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    window.location.href = "{{url('backend/usersuse')}}/" + id;
                }, function () {
                });
            }
        </script>

@endsection

